<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    function createProxy(fn, before, after) {
        return function () {
            if (isFunction(before)) before();
            const result = fn.apply(this, arguments);
            if (isFunction(after)) after();
            return result;
        };
    }

    function isFunction(param) {
        return typeof param === 'function';
    }

    function myFunction(id) {
        console.log("Function is executed");
        console.log(id);
    }

    const proxiedFunction = createProxy(() => myFunction(1), () => console.log("Before execution"), () => console.log("After execution"));
    proxiedFunction();

</script>
</html>
